<template>
	<view class="sys_artic">
		<view class="noneping" v-if="list.length == 0">
			<image src="@/static/ics/bg1.png" mode=""></image>
			<view class="">暂无数据~</view>
		</view>
		<view class="artList" v-else>
			<view @click="artDet(i)" class="itemL" v-for="(i,d) in list" :key="d">
				<view class="left">
					<view class="">{{i.saName}}</view>
					<view class="">{{i.saCreatetime}}</view>
				</view>
				<view class="right">
					<image :src="baseURLImgUPD+i.saImage" mode=""></image>
				</view>
			</view>
		</view>

		<zdy-tabbar :current-page="0"></zdy-tabbar>
	</view>
</template>

<script>
	import {
		saList
	} from '@/api/pagesApi/index.js'
	// 图片服务器
	import baseURLShowImgUP from "@/api/base.js";
	export default {
		data() {
			return {
				baseURLImgUPD:'',
				list: [],
				form: {
					total: 0, //总页数
					pageSize: 10, //每页条数
					pageNum: 1, //默认当前页
					reasonable:false,
				},
			}
		},
		onShow() {
			this.baseURLImgUPD = baseURLShowImgUP.baseURLShowImgUP;
		},
		onLoad() {
			this.form.pageNum = 1
			this.getList()
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.form.pageNum = 1
			this.list = []
			this.getList()
			uni.stopPullDownRefresh(); //停止刷新
		},
		onReachBottom(){
			this.getList()
		},
		methods: {
			getList(){
				saList(this.form).then(res => {
					this.form.pageNum = this.form.pageNum + 1
					this.list.push.apply(this.list, res.data.rows);
				})
			},
			artDet(i) {
				uni.navigateTo({
					url: `./detail?id=${i.saId}`
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.sys_artic {
		width: calc(100% - 40rpx);
		min-height: calc(100vh - 210rpx);
		padding: 20rpx 20rpx 190rpx;
		background-color: #f6f6f6;

		.artList {
			background-color: #FFF;
			width: calc(100% - 0rpx);
			min-height: 50rpx;

			.itemL {
				width: calc(100% - 80rpx);
				padding: 20rpx 0;
				margin: 0 auto;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 1rpx solid #F3F3F3;

				.left {
					flex: 1;
					height: 150rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					font-size: 32rpx;
					font-weight: 400;

					view:first-child {
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
					}

					view:last-child {
						color: #9F9F9F;
						font-size: 24rpx;
					}
				}

				.right {
					margin-left: 20rpx;
					width: 220rpx;
					height: 150rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}
			}
		}
	}
	.noneping {
		width: 100%;
		display: flex;
		align-items: center;
		flex-direction: column;
		justify-content: center;
	
		view {
			margin-top: 30rpx;
		}
	
		image {
			margin-top: 80rpx;
			width: 400rpx;
			height: 400rpx;
		}
	
		view:first-child {
			color: #999;
			font-size: 24rpx;
			height: 120rpx;
			background-color: #fff;
			border-radius: 16rpx;
	
		}
	}
</style>